<?php
$link = mysqli_connect("localhost","root","root","2113");
// 通过 get参数 传 当前页码  ，当前显示的条数 ；
$p=1;
if(!empty($_GET['p'])){
    $p=$_GET['p'];
}
$perpage=5;
if(!empty($_GET['perpage'])){
    $perpage=$_GET['perpage'];
}
$start=($p-1)*$perpage;
$sql="SELECT * FROM addnews LIMIT $start,$perpage";
$res=mysqli_query($link,$sql);

$arr = [];
while($one=mysqli_fetch_assoc($res)){
	
	$arr[] = $one;
}
echo json_encode($arr);


?>